package org.gd.hellojavacore.swing;

import javax.swing.*;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

public class PasswordFieldTest extends JFrame {

    private StringBuilder password;
    private JPasswordField passwordField;

    public PasswordFieldTest(){
        super();
        password = new StringBuilder();
        passwordField = new JPasswordField(40);
        add(passwordField);
        setLayout(new FlowLayout());
        passwordField.setEchoChar('*');
        passwordField.addKeyListener(new PswKeyListener(passwordField, password));
        add(passwordField);
    }

}

